package com.ean.backpack.domain;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Calendar;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.springframework.format.annotation.DateTimeFormat;

@Entity
@Table(name = "regioncentercoordinateslist")
public class Regioncentercoordinateslist implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 9101948397819654912L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "RegionID")
	private Integer regionId;

	public Integer getRegionId() {
		return this.regionId;
	}

	public void setRegionId(Integer id) {
		this.regionId = id;
	}

	@Column(name = "RegionName", length = 255)
	private String regionName;

	@Column(name = "CenterLatitude", precision = 9, scale = 6)
	private BigDecimal centerLatitude;

	@Column(name = "CenterLongitude", precision = 9, scale = 6)
	private BigDecimal centerLongitude;

	@Column(name = "TimeStamp")
	@NotNull
	@Temporal(TemporalType.TIMESTAMP)
	@DateTimeFormat(style = "MM")
	private Calendar timeStamp;

	public String getRegionName() {
		return regionName;
	}

	public void setRegionName(String regionName) {
		this.regionName = regionName;
	}

	public BigDecimal getCenterLatitude() {
		return centerLatitude;
	}

	public void setCenterLatitude(BigDecimal centerLatitude) {
		this.centerLatitude = centerLatitude;
	}

	public BigDecimal getCenterLongitude() {
		return centerLongitude;
	}

	public void setCenterLongitude(BigDecimal centerLongitude) {
		this.centerLongitude = centerLongitude;
	}

	public Calendar getTimeStamp() {
		return timeStamp;
	}

	public void setTimeStamp(Calendar timeStamp) {
		this.timeStamp = timeStamp;
	}

	@Override
	public String toString() {
		return ReflectionToStringBuilder.toString(this,
				ToStringStyle.SHORT_PREFIX_STYLE);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((centerLatitude == null) ? 0 : centerLatitude.hashCode());
		result = prime * result
				+ ((centerLongitude == null) ? 0 : centerLongitude.hashCode());
		result = prime * result
				+ ((regionId == null) ? 0 : regionId.hashCode());
		result = prime * result
				+ ((regionName == null) ? 0 : regionName.hashCode());
		result = prime * result
				+ ((timeStamp == null) ? 0 : timeStamp.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Regioncentercoordinateslist other = (Regioncentercoordinateslist) obj;
		if (centerLatitude == null) {
			if (other.centerLatitude != null)
				return false;
		} else if (!centerLatitude.equals(other.centerLatitude))
			return false;
		if (centerLongitude == null) {
			if (other.centerLongitude != null)
				return false;
		} else if (!centerLongitude.equals(other.centerLongitude))
			return false;
		if (regionId == null) {
			if (other.regionId != null)
				return false;
		} else if (!regionId.equals(other.regionId))
			return false;
		if (regionName == null) {
			if (other.regionName != null)
				return false;
		} else if (!regionName.equals(other.regionName))
			return false;
		if (timeStamp == null) {
			if (other.timeStamp != null)
				return false;
		} else if (!timeStamp.equals(other.timeStamp))
			return false;
		return true;
	}

}
